package com.eshidai.simple_springboot.task;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import com.eshidai.simple_springboot.bean.MsgSend;
import com.eshidai.simple_springboot.service.MsgSendService;

@Component
public class AsyncTask {
	
	@Autowired
	public MsgSendService msgSendService;
	
	@Value("${com.eshidai.simple_springboot.msgid}") private Integer msgId;
	
	@Async
	public void doTask() {
		//......
		MsgSend msg = new MsgSend();
		msg.setMsgId(msgId.toString());
		msg.setMsgType(1);
		msg.setSendTime("2017-03-31 13:01:01");
		
		msgSendService.create(msg);
	}
}
